package jmu.edu.yjc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jmu.edu.yjc.domain.entity.Dictionary;
import jmu.edu.yjc.mapper.DictionaryMapper;
import jmu.edu.yjc.service.DictionaryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 字典表(Dictionary)表服务实现类
 *
 * @author makejava
 * @since 2023-03-22 23:59:43
 */
@Service("dictionaryService")
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements DictionaryService {

    @Override
    public Dictionary getByKeyAndTable(String key, String tableName) {
        LambdaQueryWrapper<Dictionary> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Dictionary::getKeyCode,key)
                .eq(Dictionary::getGroupTable,tableName);
        return getOne(wrapper);
    }
}
